package com.colin.app.activity.main;

import android.support.v4.app.Fragment;

import com.colin.app.app.AppActivity;
import com.colin.app.app.BaseModelImpl;
import com.colin.app.fragment.demo.DemoFragment;
import com.colin.app.fragment.home.HomeFragment;
import com.colin.app.fragment.mine.MineFragment;
import com.colin.app.fragment.permission.PermissionFragment;
import com.colin.library.other.Constants;

import java.util.ArrayList;
import java.util.List;

import static com.colin.library.other.Constants.FRAGMENT_ID_MAIN_DEMO;
import static com.colin.library.other.Constants.FRAGMENT_ID_MAIN_HOME;
import static com.colin.library.other.Constants.FRAGMENT_ID_MAIN_MINE;
import static com.colin.library.other.Constants.FRAGMENT_ID_MAIN_PERMISSION;

/**
 * Created by Colin on 2017/1/15.
 */

public class MainModelImpl extends BaseModelImpl implements MainContract.MainModel {
    private int position = 0;


    @Override
    public String getTitle() {
        return Constants.FRAGMENT_MAIN_TITLE[position];
    }

    @Override
    public List<Integer> getFragmentIDList() {
        List<Integer> idList = new ArrayList<>();
        idList.clear();
        idList.add(FRAGMENT_ID_MAIN_HOME);
        idList.add(FRAGMENT_ID_MAIN_DEMO);
        idList.add(FRAGMENT_ID_MAIN_PERMISSION);
        idList.add(FRAGMENT_ID_MAIN_MINE);
        return idList;
    }

    @Override
    public List<Fragment> getFragmentList(AppActivity mAppActivity) {
        List<Fragment> fragmentList = new ArrayList<>();
        fragmentList.clear();
        fragmentList.add(HomeFragment.newInstance(mAppActivity, FRAGMENT_ID_MAIN_HOME));
        fragmentList.add(DemoFragment.newInstance(mAppActivity, FRAGMENT_ID_MAIN_DEMO));
        fragmentList.add(PermissionFragment.newInstance(mAppActivity, FRAGMENT_ID_MAIN_PERMISSION));
        fragmentList.add(MineFragment.newInstance(mAppActivity, FRAGMENT_ID_MAIN_MINE));
        return fragmentList;
    }

    @Override
    public int getPosition() {
        return position;
    }

    @Override
    public void setPosition(int position) {
        this.position = position;
    }
}
